package Shale;

import java.util.ArrayList;
import java.util.List;

/**
 * @author leiwenkang <leiwenkang@kuaishou.com>
 * Created on 2021-11-18
 * @description:
 */
public class ShaleTest {

    @SuppressWarnings("checkstyle:MagicNumber")
    public static void main(String[] args) {
        List<Supply> supplyList = new ArrayList<>();
        List<Demand> demandList = new ArrayList<>();


        supplyList.add(new Supply(0, new Target("北京", "男"), 2731));
        supplyList.add(new Supply(1, new Target("北京", "女"), 1923));
        supplyList.add(new Supply(2, new Target("上海", "男"), 1457));
        supplyList.add(new Supply(3, new Target("上海", "女"), 921));

        demandList.add(new Demand(0, new Target("上海", null), 1021));
        demandList.add(new Demand(1, new Target("北京&上海", "男"), 4088));
        Demand newDemand = new Demand(2, new Target("北京&上海", "男"), 0);

        ShaleContext context = new ShaleContext(supplyList, demandList, newDemand);
        new QueryProcessor().process(context);

        System.out.println(context.getResult());
        StringBuilder supplyStr = new StringBuilder("supplyId\tinventory\tremain\n");
        for (Supply supply : supplyList) {
            supplyStr.append(supply.getId() + "\t\t\t\t" + supply.getTotal() + "\t\t\t" + supply.getRemain() + "\n");
        }
        System.out.println(supplyStr);
    }
}
